<template>
  <div></div>
</template>

<script setup>
import { useMenuStore } from "../../store";
import {
  measureTool,
  clearMeasureTool,
  downloadMap,
} from "../../utils/measureTool";
let map = null;
let menuStore = useMenuStore();
// 加载地图
onMounted(() => {
  map = inject("$map");
});
//监听选择按钮activeIndex值变化
watch(
  () => menuStore.activeIndex,
  (val) => {
    switch (val) {
      // 点击测量距离
      case "7-1":
        measureTool(map, "length");
        break;
      // 点击测量面积
      case "7-2":
        measureTool(map, "area");
        break;
      // 点击关闭测量
      case "7-3":
        clearMeasureTool(map);
        break;
      // 点击导出图片
      case "7-4":
        downloadMap(map);
        break;
      default:
        break;
    }
  }
);
</script>

<style lang="scss" scoped></style>
